// index.js
// 获取应用实例
const app = getApp()
const db = wx.cloud.database();

Page({
  data: {
    userInfo: {}
  },
  callGod() {
    const views = db.collection('views')
    views.add({
      data: {
        ...this.data.userInfo,
        date: new Date().getTime()
      }
    })
    wx.redirectTo({
      url: '../wait/index'
    })
  },
  onShow() {
    wx.getUserInfo({
      success: (res) => {
        const userInfo = res.userInfo
        this.setData({
          userInfo
        })
      }
    })
  },
  onLoad() {
  },
  onShareTimeline() {
    return {
      title: '马上召唤你的守护神，让你寄托良愿，安抚心灵，功德+1',
      imageUrl: 'https://6475-dunhuang-2guh623s2047d720-1318886299.tcb.qcloud.la/share-image.png',
      path: '/pages/index/index',
      query: 'referrer=friend'
    }
  },
  onShareAppMessage() {
    return {
      title: '马上召唤你的守护神，让你寄托良愿，安抚心灵，功德+1',
      imageUrl: 'https://6475-dunhuang-2guh623s2047d720-1318886299.tcb.qcloud.la/share-image.png',
      query: 'referrer=friend',
      path: '/pages/index/index'
    }
  }
})
